<?php

namespace app\http\middleware;

use app\models\{Shoplist};

use think\Db;

class Business
{
    public function handle($request, \Closure $next)
    {
        $id = session('business_id');
        $bussine = (new Shoplist())->where('id', $id)->find();
        $url = $request->baseUrl();
        if (!$bussine && $url != '/index/login') {
            return redirect('index/login');
        }
        $request->bussiness = $bussine;
        return $next($request);
    }
}
